﻿using System;
using System.Drawing;
namespace LeRenard.Libraries.Drawing.GdiPlus.Forms
{
    /// <summary>
    /// Defines a backbuffer to draw frames on.
    /// </summary>
    public interface IBuffer : IDisposable
    {
        /// <summary>
        /// Gets the <see cref="Buffer"/>'s width and height in pixels.
        /// </summary>
        Size Size { get; }

        /// <summary>
        /// Gets the <see cref="Graphics"/> GDI surface to draw on.
        /// </summary>
        Graphics Graphics { get; }

        /// <summary>
        /// Returns the current state of the <see cref="Buffer"/> as a <see cref="Bitmap"/>.
        /// </summary>
        /// <returns>A <see cref="Bitmap"/> representing the current state of the <see cref="Buffer"/>.</returns>
        Bitmap Render();

        /// <summary>
        /// Clears the <see cref="Buffer"/>'s drawing area to black.
        /// </summary>        
        void Clear();        

        /// <summary>
        /// Clears the <see cref="Buffer"/>'s drawing area to the specified <paramref name="color"/>.
        /// </summary>
        /// <param name="color">The color to use as backdrop when clearing.</param>
        void Clear(Color color);   
     
        /// <summary>
        /// Resizes the <see cref="Buffer"/>'s drawing area to the specified <paramref name="size"/>.
        /// </summary>
        /// <param name="size">The new <see cref="Size"/> of the buffer.</param>
        void Resize(Size size);
    }
}
